1. Field of the Invention
The present invention relates to an image processing apparatus and an image processing method used in an image forming apparatus such as an MFP.
2. Description of the Related Art
Image forming apparatuses that form images using the electrophotographic method, such as, for example, photocopiers, printers, facsimiles, and apparatuses with multiple functions (called MFPs or multi-function peripherals), have conventionally been used to copy documents and the like. When an MFP is used to copy a document while the document lid is open, regions outside of the document normally appear black in the copy.
In response to this, a method that prevents the outside regions from appearing black by eliminating the outside regions, or in other words, by replacing those regions with white color data, has been proposed (see Patent Document 1: JP 2003-60878A). This method detects the position of the ends of the document and replaces the regions on the outer side of the detected end positions with white color data. The image processing apparatus according to Patent Document 1 also includes functionality for detecting a peak value in a histogram of luminance data and taking that peak as the base level (ground level) of the document, and automatically selecting a method for eliminating the regions outside of the document (from among an angular elimination method and a rectangular elimination method, both of which shall be described later) based on a comparison between the base level of the document and a threshold.
Another method has been proposed, in which an inputted image is divided into a plurality of regions based on density (darkness), while reducing the influence of noise, by setting a threshold only for pixels on the edges of the inputted image (see Patent Document 2: JP H06-83959A). Here, a threshold adapted for region division is set so that there is a higher chance that points indicating the borders of regions will be present in the edges.
The number of border points for the regions can be found based on the difference between a cumulative histogram of the inputted image (that is, a histogram in which a darkness and the total pixels having a darkness that is greater than the darkness value of that darkness are associated with one another, for each darkness) and a cumulative histogram of the image after a minimum filtering process has been executed thereon. In other words, cumulative histograms of the input image found in the edges and the input image on which a minimum filtering process has been executed are created, and the number of border points in the edges is found based on the difference between the cumulative histograms. A proper region division is thus implemented by setting a threshold that increases the chance that border points will be present in the edges.
However, when a histogram created based on the entire scanned image is used, as is the case with the method in Patent Document 1, the darkness data outside of the regions surrounding the document results in noise. While this does not present a problem in a text document, where there is only a single base level and the content is clear and pronounced, there are many cases where erroneous determination occurs when selecting the elimination method for the regions outside the edges of a document that, for example, includes many photographs, which results in the selection of an inappropriate elimination method. In other words, erroneous determination occurs, in which the rectangular elimination method is selected despite the fact that the angular elimination method should have been selected or vice versa.
Furthermore, because the pixels in the edges include the darkness values near the threshold (and including the threshold itself), it is difficult, with the method according to Patent Document 2, to select an appropriate elimination method by dividing the document into document regions and non-document regions based on the threshold, or in other words, by accurately detecting the edge of the document.
The following can be given as another method for selecting an elimination method. A histogram is created for an overall image based on image data scanned and generated by a scanning unit (in other words, a scanned image) while the document lid is open, such as that shown in FIG. 12A; the base luminance value of the document is compared with a predetermined threshold in the created histogram, as illustrated in FIG. 13A. The base luminance value can be found using a conventionally proposed and publicly-known method. In this case, the base luminance value is greater than the threshold, and thus the angular elimination method is selected as the elimination method. Referring to FIG. 12A, the left part of an object, which corresponds to a region RN in FIG. 11, appears to be missing. This is because the luminance value in the left part of the object is extremely low.
Meanwhile, a histogram is created for an overall image based on image data scanned and generated by a scanning unit (in other words, a scanned image) while the document lid is open, such as that shown in FIG. 12B; the base luminance value of the document is compared with a predetermined threshold in the created histogram, as illustrated in FIG. 13B. In this case, the base luminance value is lower than the threshold, and thus the rectangular elimination method is selected as the elimination method.
However, in the case of the former (FIG. 13A), regions that are not supposed to be eliminated are eliminated, whereas in the case of the latter (FIG. 13B), the rectangular elimination method is selected even though the angular elimination method can be used, and thus regions that are outputted as black (solid black regions) arise needlessly.